package cn.lopr.im.android.utils;

import android.app.Dialog;
import android.content.Context;
import android.view.Window;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;

import cn.lopr.im.android.R;

/**
 * @author shuangyang7
 * @date 2020/12/29 21:52
 */
public class LoadingDialog {

    public static Dialog dialog;
    public static Date data;

    public static void showDialog(Context context) {
        dialog = new Dialog(context, R.style.dialog);
        Objects.requireNonNull(dialog.getWindow()).requestFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_loading);
        dialog.setCanceledOnTouchOutside(false);
        dialog.show();
    }

    public static void disDialog() {
        dialog.dismiss();
    }

    public static String getTime() {
        data = new Date(System.currentTimeMillis());
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return format.format(data);
    }
}
